package com.example.kotlinstudy.s8

fun main() {
   var configDiscountWords: (String) -> String = getDiscountWords()
    /* println(configDiscountWords.invoke("lzj"))*/
    println(configDiscountWords("lzj"))//还可以这样写

  showOnBoard("~~~", getDiscountWords())
}

//匿名函数作为返回值
private fun getDiscountWords(): (String) -> String { //(传值类型) -> 返回类型
    return { goodsName: String ->
        "nihao $goodsName"
    }
}

private fun showOnBoard(goodName: String, getDiscountWords: (String) -> String) {
    println(getDiscountWords("lzj") +goodName)
}